﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Celltest
{
    class GUI
    {
        public GUI()
        {
        }

        public void MakeStep(byte b, Position oldPos, Position newpos)
        {
            Console.SetCursorPosition(oldPos.X,oldPos.Y);
            WriteAt(0,oldPos);
            WriteAt(b, newpos);
            
        }

        public void WriteAt(byte b , Position pos)
        {
            char c = Encoding.GetEncoding(437).GetChars(new byte[] { b })[0];
            try
            {
                Console.SetCursorPosition(pos.X, pos.Y);
                Console.Write(c);
            }
            catch (ArgumentOutOfRangeException e)
            {
                
                //Console.Write(e);
               //Console.SetCursorPosition(0, 0);
                Console.Clear();
                //throw;

            }
           
            //Console.Write(c);
            
        }
        public void WriteTextAt(string Text, Position pos)
        {
            Console.SetCursorPosition(pos.X,pos.Y);
            Console.Write(Text);
        }
    }
}
